﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PhotoHsn.AdminControlPanel
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'dataSet1.EquipmentTypes' table. You can move, or remove it, as needed.
            this.equipmentTypesTableAdapter.Fill(this.dataSet1.EquipmentTypes);
            // TODO: This line of code loads data into the 'dataSet1.Brands' table. You can move, or remove it, as needed.
            this.brandsTableAdapter.Fill(this.dataSet1.Brands);
           
        

        }

        private void brandsBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.brandsBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.dataSet1);

        }

        private void fillByEquipmentTypeIdToolStripButton_Click(object sender, EventArgs e)
        {
           

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                this.brandsTableAdapter.FillByEquipmentTypeId(this.dataSet1.Brands, ((byte)(System.Convert.ChangeType(comboBox1.SelectedValue , typeof(byte)))));
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }

        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            brandsDataGridView.Rows[brandsDataGridView.NewRowIndex].Cells[2].Value = comboBox1.SelectedValue;
        }


      

      
       

      
    }
}
